<template>
	<contents
		:heightInclude="['tabBar']"
		:nullData="detailList.length === 0"
		nullText="还没领取会员卡哦~"
		nullImg="http://img.druglots.cn/no_record.png"
	>
		<view>
			<cardItem
				class="u-margin-top-18"
				v-if="detailList.length > 0"
				:cardList="detailList"
			/>
		</view>
	</contents>
</template>

<script>
import cardItem from './cardItem.vue'
import { getMemberCardList } from '@/api/http/cardbag.js'
export default {
	components: {
		cardItem
	},
	data() {
		return {
			detailList: [],
			pageData: {
				pageNo: 1,
				pageSize: 10
			},
			total: 0
		}
	},
	created() {
		this.getMemberCardList()
	},
	methods: {
		// 获取会员卡列表
		async getMemberCardList() {
			const res = await getMemberCardList(this.pageData)

			if (res.code === 200) {
				if (res.data) {
					this.detailList.push(...res.data)
				}
			} else {
				uni.showToast({
					title: res.message,
					icon: 'none'
				})
			}
		},

	}
	// onReachBottom() {
	// 	if (this.detailList.length <= this.pageData.pageNo * this.pageData.pageSize) {
	// 		return
	// 	}

	// 	Object.assign(this.pageData, {
	// 		pageNo: this.pageData.pageNo++
	// 	})

	// 	this.getMemberCardList()
	// }
}
</script>

<style></style>
